package gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.Text;

/**
 * Panel with help text for the Infobar.
 */
public class HelpPanel extends InfoPanel {

	/**
	 * Construct a new HelpPanel in the infobar
	 * @param infoBar ExpandBar to onstruct the HelpPanel in.
	 * @param helpText Text to display.
	 */
	public HelpPanel(ExpandBar infoBar, String helpText) {
		super(infoBar, "Help");
		setExpanded(false);
		setLayout(new FillLayout());
			
		setLayout(new GridLayout(1, false));
		Text text = new Text(this, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI );
		text.setText(helpText);
		GridData gridData = new GridData();
	    gridData.grabExcessHorizontalSpace = true;
	    gridData.widthHint = 250;
	    text.setLayoutData(gridData);
		
		setIcon(SWT.ICON_QUESTION);
		updateHeight();
	}

}
